﻿using System;
using UnityEngine;

namespace Spline
{
	// Token: 0x020003FE RID: 1022
	internal class SNS : RNS
	{
		// Token: 0x0600197C RID: 6524 RVA: 0x000A4BB4 File Offset: 0x000A2DB4
		public override void BuildSpline()
		{
			base.Build();
			this.Smooth();
			this.Smooth();
			this.Smooth();
		}

		// Token: 0x0600197D RID: 6525 RVA: 0x000A4BD0 File Offset: 0x000A2DD0
		protected virtual void Smooth()
		{
			this.Smoothing();
		}

		// Token: 0x0600197E RID: 6526 RVA: 0x000A4BD8 File Offset: 0x000A2DD8
		protected void Smoothing()
		{
			Vector3 velocity = base.GetStartVelocity(0);
			for (int i = 1; i < this.nodeCount - 1; i++)
			{
				Vector3 vector = base.GetEndVelocity(i) * this.node[i].distance + base.GetStartVelocity(i) * this.node[i - 1].distance;
				vector /= this.node[i - 1].distance + this.node[i].distance;
				this.node[i - 1].velocity = velocity;
				velocity = vector;
			}
			this.node[this.nodeCount - 1].velocity = base.GetEndVelocity(this.nodeCount - 1);
			this.node[this.nodeCount - 2].velocity = velocity;
		}

		// Token: 0x0600197F RID: 6527 RVA: 0x000A4CCC File Offset: 0x000A2ECC
		protected virtual void SmoothingLast()
		{
			this.node[this.nodeCount - 1].velocity = base.GetEndVelocity(this.nodeCount - 1);
		}

		// Token: 0x06001980 RID: 6528 RVA: 0x000A4CF4 File Offset: 0x000A2EF4
		public override float RenewMove(Vector3 pos, float time)
		{
			int num;
			int num2;
			float rate;
			base.TimeState(time, out num, out num2, out rate);
			base.RemoveHeadNode();
			base.AddNode(pos);
			base.BuildLast();
			this.SmoothingLast();
			this.SmoothingLast();
			this.SmoothingLast();
			return base.GetTime(num - 1, rate);
		}
	}
}
